| Conditions | 2 |
| Total Lines | 21 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { |
||
| 26 | |||
| 27 | @Post() |
||
| 28 | @ApiOperation({title: 'Add new event'}) |
||
| 29 | public async index(@Body() dto: EventDTO, @LoggedUser() user: User) { |
||
| 30 | try { |
||
| 31 | const {type, date, projectId, taskId, summary, time} = dto; |
||
| 32 | const id = await this.commandBus.execute( |
||
| 33 | new AddEventCommand( |
||
| 34 | type, |
||
| 35 | user, |
||
| 36 | Number(time), |
||
| 37 | new Date(date), |
||
| 38 | projectId, |
||
| 39 | taskId, |
||
| 40 | summary |
||
| 41 | ) |
||
| 42 | ); |
||
| 43 | |||
| 44 | return {id}; |
||
| 45 | } catch (e) { |
||
| 46 | throw new BadRequestException(e.message); |
||
| 47 | } |
||
| 50 |